<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: red;
        }

        /* 在所有设备中都生效 */
        @media all {
            div {
                width: 300px;
                height: 300px;
                background-color: blue;
            }
        }

        /* 在打印机中生效的样式 */
        @media print {
            div {
                width: 400px;
                height: 400px;
                background-color: pink;
            }
        }
        /* 在电脑屏幕上 */
        @media screen {
            div {
                width: 500px;
                height: 500px;
                background-color: green;
            }
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>
